package com.buba.user.controller;


import com.buba.pojo.user.Campus;
import com.buba.pojo.system.Health;
import com.buba.utils.R;
import com.buba.user.service.CampusService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * <p>
 * 院区表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-06-09
 */
@RestController
@RequestMapping("/user/campus")
public class CampusController {

    @Autowired
    private CampusService campusService;

    /**
     * @Author 梁玉杰
     * @Description //所有院区列表
     * @Return com.buba.utils.R
     * @throws
     * @Date 2022/6/10 16:00
     **/
    @ApiOperation(value = "所有院区列表")
    @PostMapping("/findAllCampus")
    public R findAllCampus() {
        return campusService.findAllCampus();
    }

    /**
     * @Author 梁玉杰
     * @Description //院区详情
     * @param Integer id
     * @Return com.buba.utils.R
     * @throws
     * @Date 2022/6/10 16:06
     **/
    @ApiOperation(value = "院区详情")
    @GetMapping("/findByCampusID/{id}")
    public R findByHealthID( @ApiParam(name = "id", value = "院区表的ID", required = true)
                             @PathVariable Integer id) {
        return campusService.findByCampusID(id);
    }


    @GetMapping({"getHospitals"})
    public R getHospitals() {
        List<Campus> list = this.campusService.getHospitals();
        return list != null ? R.ok().data("list", list) : R.error();
    }




}

